#include "Fire.h"
#include "Util.h"

const float doDamage = 1;

const int linesToFall = 1;

const float timeToSpitFireBalls = 3.0;
const Vector2 Fire::AVAILABLES_DIRECTIONS[] = { Vector2::Right(), Vector2::Left(), Vector2::Up(), Vector2::Down(), 
	  Vector2::DownRight(), Vector2::DownLeft(), Vector2::UpLeft(), Vector2::UpRight() };

Vector2 Fire::RaffleDirection()
{
	int index = (int)(rand() % 8) - 1;
	
	return AVAILABLES_DIRECTIONS[index];
}

void Fire::Initialize(int level)
{
	switch(level)
	{
		case 1:
			// just create the lava fields
		break;

		case 2:
			Fire::amountOfCreateFireballs = Fire::AMOUNT_OF_FIREBALLS_LEVEL1;
		break;

		case 3:
			Fire::amountOfCreateFireballs = Fire::AMOUNT_OF_FIREBALLS_LEVEL2;
		break;
	}
}

void Fire::Update(Player player)
{
	if (!player.GetCollisionRect().Intersects(Fire::GetCollisionRect()) /*or collide with fireball*/) return;
	if (Fire::amountOfCreateFireballs != 0)
	{
		for (int i = 0; i < amountOfCreateFireballs; i++)
		{
			//Fireball f = Fireball();
			//f.SetDirection(Util::RaffleDirection());
		}
	}
	//player.Hurt(Fire::doDamage);
	//player.Fall(linesToFall);
	
}

void Fire::Destroy()
{

}